import { Department } from "@/store/modules/data-dictionary/department";
import { http } from "@/utils/http/axios";

/**
 * @description 按条件查询部门.
 * @param condition 查询的条件.
 */
export const listDepartmentByCondition = (condition: Department) => {
  return http.request({
    url: "/data-dictionary/department/search",
    method: "POST",
    data: condition,
  });
};

export function insertDepartment(data: Department) {
  return http.request({
    url: "/data-dictionary/department",
    method: "POST",
    data: data,
  });
}

export function editDepartment(id: number, data: Department) {
  return http.request({
    url: `/data-dictionary/department/${id}`,
    method: "PUT",
    data: data,
  });
}

export function deleteDepartmentById(ids: number[]) {
  return http.request({
    url: "/data-dictionary/department/batch-delete",
    method: "post",
    data: ids,
  });
}
